<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" th:href="@{/css/main.css}" />
    <title>SpringMVC5+Thymeleaf迭代器示例</title>
</head>
<body>
<h2>Spring MVC5 + Thymeleaf迭代器示例</h2>
<table>
    <thead>
    <tr>
        <th>序号order</th>
        <th>产品name</th>
        <th>价格price</th>
        <th>有效日期</th>
    </tr>
    </thead>
    <tbody th:remove="all-but-first">
    <tr th:each="product : ${productList}">
        <td th:text="${productStat.count}">1</td>
        <td th:text="${product.description}">Red chair</td>
        <td th:text="${'$' + #numbers.formatDecimal(product.price, 1, 2)}">￥350</td>
        <td th:text="${#dates.format(product.availableFrom, 'dd-MM-yyyy')}">2018-02-20</td>
        <td><span th:if="${product.price gt 1}" class="offer">(TeShuTiGong)</span></td>
    </tr>
    <!-- 上面的 <tbody th:remove="all-but-first"> 会下面的tr会先删除 -->
    <tr>
        <td>White table</td>
        <td>11</td>
        <td>2018-04-10</td>
    </tr>
    <tr>
        <td>Reb table</td>
        <td>22</td>
        <td>2018-02-20</td>
    </tr>
    <tr>
        <td>Blue table</td>
        <td>33</td>
        <td>2018-02-20</td>
    </tr>
    </tbody>
</table>

</body>
</html>